/*
 * Powered By dico
 * Since 2017 - 2018
 */package com.seeyoui.kensite.framework.system.service;
 
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.seeyoui.kensite.common.base.service.BaseService;

import java.util.*;

import com.seeyoui.kensite.common.base.domain.EasyUIDataGrid;
import com.seeyoui.kensite.common.base.service.BaseService;
import com.seeyoui.kensite.common.exception.CRUDException;
import com.seeyoui.kensite.common.util.*;
import com.seeyoui.kensite.common.constants.StringConstant;
import com.seeyoui.kensite.framework.system.domain.SysNotice;
import com.seeyoui.kensite.framework.system.persistence.SysNoticeMapper;

/**
 * SysNotice
 * @author dico
 * @version 2.0
 * @since 1.0
 * @date 2018-01-08
 */

@Service
public class SysNoticeService extends BaseService {
	
	@Autowired
	private SysNoticeMapper sysNoticeMapper;

	/**
	 * 根据ID查询单条数据
	 * @param id
	 * @return
	 * @throws CRUDException
	 */
	public SysNotice findOne(String id) throws CRUDException{
		return sysNoticeMapper.findOne(id);
	}
	
	/**
	 * 查询数据集合
	 * @param sysNotice
	 * @return
	 * @throws CRUDException
	 */
	public List<SysNotice> findList(SysNotice sysNotice) throws CRUDException {
		return sysNoticeMapper.findList(sysNotice);
	}
	
	/**
	 * 查询最近一周的数据集合
	 * @return List<SysNotice>
	 * @throws CRUDException
	 */
	public List<SysNotice> findRecently() throws CRUDException {
		return sysNoticeMapper.findRecently();
	}
	
	/**
	 * 查询所有数据集合
	 * @param sysNotice
	 * @return
	 * @throws CRUDException
	 */
	public List<SysNotice> findAll(SysNotice sysNotice) throws CRUDException {
		return sysNoticeMapper.findAll(sysNotice);
	}
	
	/**
	 * 查询数据总数
	 * @param sysNotice
	 * @return
	 * @throws CRUDException
	 */
	public int findTotal(SysNotice sysNotice) throws CRUDException {
		return sysNoticeMapper.findTotal(sysNotice);
	}
	
	/**
	 * 查询数据总数排除当前数据
	 * @param sysNotice
	 * @return
	 * @throws CRUDException
	 */
	public int findExTotal(SysNotice sysNotice) throws CRUDException {
		return sysNoticeMapper.findExTotal(sysNotice);
	}
	
	/**
	 * 数据新增
	 * @param sysNotice
	 * @throws CRUDException
	 */
	public void save(SysNotice sysNotice) throws CRUDException{
		sysNotice.preInsert();
		sysNoticeMapper.save(sysNotice);
	}
	
	/**
	 * 数据修改
	 * @param sysNotice
	 * @throws CRUDException
	 */
	public void update(SysNotice sysNotice) throws CRUDException{
		sysNotice.preUpdate();
		sysNoticeMapper.update(sysNotice);			
	}
	
	/**
	 * 数据删除
	 * @param listId
	 * @throws CRUDException
	 */
	public void delete(List<String> listId) throws CRUDException {
		sysNoticeMapper.delete(listId);
	}
	
	/**
	 * 数据假删除
	 * @param sysNotice
	 * @throws CRUDException
	 */
	public void remove(SysNotice sysNotice) throws CRUDException{
		sysNotice.preUpdate();
		sysNoticeMapper.remove(sysNotice);			
	}
	
}